#!/bin/bash
set -e

cd $(dirname $0)/..

echo Running validation

BUILDTAGS="static"
PACKAGES="$(go list -tags "$BUILDTAGS" ./...)"

if ! command -v golangci-lint; then
    echo Skipping validation: no golangci-lint available
    exit
fi

echo Running validation

echo Running: golangci-lint
golangci-lint run

echo Running: go fmt
test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)"
